How to Run Mac OS on VMware ESXi


عضو شوید


نام کاربری
رمز عبور

:: فراموشی رمز عبور؟

عضویت سریع

نام کاربری
رمز عبور
تکرار رمز
ایمیل
کد تصویری
براي اطلاع از آپدیت شدن وبلاگ در خبرنامه وبلاگ عضو شويد تا جديدترين مطالب به ايميل شما ارسال شود



تاریخ : جمعه 29 فروردين 1399
بازدید : 1909
نویسنده : نعـــــــــــــــیم ایــــــرانــــی

 

In present day, VMware is one of the leading providers in virtualization technologies. Hardware virtualization allows you to run virtual machines with various operating systems including Windows, Linux, and FreeBSD on different hosts, while providing you with the ability to migrate VMs between hosts. In some cases you may be required to install Mac OS on a virtual machine, for example, if you need to test applications that can only be run on Mac OS. By default, Mac OS cannot be installed on VMware ESXi or VMware Workstation. This blog post explores the ways of running Mac OS on a VMware ESXi VM.

What's more, learn how you can safeguard virtual, physical, and cloud workloads using a single solution—NAKIVO Backup & Replication. For this purpose, you can start 15-day free trial of NAKIVO Backup & Replication and access its full-fledged functionality right away without any limitations.

Preparing the ISO Installation Image

To start, you must have the ISO image of the macOS installer. If you do not already have the ISO image, you can create the installation ISO image manually by downloading a package from Apple’s official website. This blog post explains the installation process by using Mac OS X 10.12 Sierra as an example. A machine with Mac OS is required for this process, as you will be redirected to the App Store after entering these links in the browser (browsers on Windows or Linux are not able to recognize App Store links). Once the App Store window with macOS Sierra is open, you can read the operating system information. Click the Download button to begin downloading the installation package.

Downloading Mac OS X 10.12 Sierra from the App Store.

Once the downloading process has begun, you should be able to see the progress of the download in the Launchpad. Downloading the installation package of macOS Sierra may be a time-consuming process (the slow downloading of macOS Sierra is a common issue). Sometimes, temporary changing the DNS settings in your network configuration may help you to increase the download speed. Attempt using 8.8.8.8, 8.8.4.4, 4.2.2.2 or 4.2.2.3 DNS servers on your machine. If this method does not increase the download speed, left click the Downloading icon to pause your download. Then left click the icon once more to resume the download. After resuming the download of a file, the download speed increases for the appropriate period of time.

Mac OS X 10.12 Sierra is being downloaded

Once the macOS Sierra installation package has been downloaded, you can find the appropriate file in the Applications directory. Go to the Finder and click Applications in the left pane of the window. You should find the “Install macOS Sierra.app” file there.

Browsing the “Install macOS Sierra.app” file.

Right click the “Install macOS Sierra.app” file and select “Show package contents” in the context menu. Go to Contents > SharedSupport and find the InstallESD.dmg file. A DMG file is a mountable Apple disk image file that is widely used in the macOS world for distributing software. The InstallESD.dmg file must be converted to a bootable in order for it to be compatible for inserting into the virtual DVD drive of a virtual machine that is running on VMware ESXi.

Locating the InstallESD.dmg installation image downloaded from the official site

In this example, hdiutil is used to create the ISO image. Hdiutil is a built-in console utility that is available on macOS; it is used to work with disk images as data containers that emulate disks. The DiskImages framework is used by hdiutil to manipulate the disk images.

Mount the InstallESD.dmg installer image of macOS Sierra to the /Volumes/install_app mount point.

hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app

Mounting the DMG image

Create the Sierra blank ISO image of 7316 Mb with a single partition located in the /tmp/ directory. The Apple partition layout is SPUD. The journaled macOS file system is HFS+J.

hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J

Creating a blank disk image.

Mount the Sierra blank ISO image to the /Volumes/install_build mount point.

hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build

Mounting a blank disk image.

Restore the base system into the Sierra blank ISO image by using Apple Restore Software that can be directly accessed in the terminal with the asr command. After executing this command, the name of the destination mount point will be changed to “/Volumes/OS X Base System/System”.

asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase

Restoring the base system into the blank image.

Remove a package link and replace it with actual files.

rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/

Removing a package link and replacing it with actual files

Copy the Sierra installer dependencies.

cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg

Copying the Sierra installer dependencies.

Unmount the installer image.

hdiutil detach /Volumes/install_app

Unmount the Sierra ISO Image.

hdiutil detach /Volumes/OS\ X\ Base\ System/

Unmounting the installer image and the Sierra ISO image

Convert the created Sierra image to ISO CD/DVD master by using -format UDTO key.

hdiutil convert /tmp/Sierra.cdr.dmg -format UDTO -o /tmp/Sierra.iso

Converting the Sierra image to a bootable ISO format.

Rename the Sierra image file and move the file to a directory that is most convenient for you ( /disk_d/ for example).

mv /tmp/Sierra.iso.cdr /disk_d/Sierra.iso

You can also move the file to ~/Desktop/ (this is not available for root, because root cannot log in with GUI by default).

Preparing ESXi Host

Now that your bootable ISO image with the macOS installer is ready, you should prepare your ESXi host for the installation of macOS as a guest OS on VMs. You need to enable SSH access, download the patch, copy the patch to the file system of the ESXi server, and patch the ESXi server.

Enabling Remote Access via SSH

Enter the IP address of your ESXi host in the browser to access the VMware Host Client. Click Host, then click Actions > Services > Enable Secure Shell (SSH). You can also use an alternative method and enable SSH directly on the ESXi server by going to System Customization > Troubleshooting options > Enable SSH. ESXi 6.0 is used in this case. If you are using VMware vSphere Web Client, go to Configure > System > Services, then right click SSH and click Start.

Enabling Remote Access via SSH

Patching ESXi to Customize the Host for Running MacOS

The patch is needed to unlock Mac OS X in the list of available operating systems in the VM options during the creation of a VM. Virtual machines with Mac OS X are not supported by default. The patch unlocks the Mac OS X operating system family in the new VM options on ESXi, and includes VMware Tools for macOS.

Downloading a patch

The patch is free and can be downloaded from this page. MacOS Unlocker 2.0.8 is used in this example due to ESXi support. The newest version of macOS unlocker is version 3.0.2. Unlocker 2 supports both VMware ESXi and VMware Workstation, while Unlocker 3 only supports VMware Workstation (including the latest versions of VMware Workstation). Version 2.0.8 is the latest version of the patch with ESXi support.

Transferring patch files to ESXi datastore

After downloading the patch, copy the patch files to the datastore on ESXi. You can use WinSCP, which supports the transfer of files over SSH by using SFTP, SCP, WebDAV, or S3 protocols (in Linux you can use the equivalent software). WinSCP has a user-friendly graphical user interface (GUI), and consists of two main panels. Copy the unlocker files from your local directory to your datastore on the ESXi server. In this example the unlocker patch and the macOS Sierra installation ISO image (Sierra.iso) were created beforehand, and are placed in C:\Virtual\images_MacOS for convenience. The patch is copied to /vmfs/volumes/datastore1 on the ESXi server. Sierra.iso would be copied to the datastore40. Later, you can mount the ISO image from the datastore to the virtual DVD drive of the virtual machine.

Copying files to the ESXi server with WinSCP

Applying a patch

After copying the macOS unlocker patch to the ESXi server, you should add the permissions for the executable files in order to be able to apply the patch. Go to the directory where the patch is placed (if you use a different directory, type the name of your directory) by typing cd

/vmfs/volumes/datastore1/patch_unlocker208/

Make the patch installer and the patch uninstaller files executable:

chmod +x esxi-install.sh
chmod +x esxi-uninstall.sh

Type ls -al to check the files and their permissions in the current directory.

Run the macOS unlocker patch:

./esxi-install.sh

After successful patching, restart the ESXi server with the reboot command.

: Applying the macOS unlocker patch on the ESXi server.

Creating and Configuring a New VM on the ESXi Host

Copy the ISO installation image of Mac OS X 10.12 Sierra to the datastore by using VMware Embedded Host Client, VMware vSphere Client or WinSCP if you have not yet copied the image. In VMware vSphere Client, click Storage, select your datastore, click Files, and then click Upload files. In VMware Host Client, click Storage, select your datastore, click the Datastore browser, click Upload and select the file to be uploaded. You can see the Sierra.iso file uploaded into the datastore on the screenshot below.

: Applying the macOS unlocker patch on the ESXi server. Creating and Configuring a New VM on the ESXi Host

Now let’s consider how you can create and configure a new VM with VMware Host Client:

Right click Virtual Machines and select Create/Register VM in the context menu.

Creating a new VM with VMware Host Client.

A window of the New virtual machine wizard appears. Click Create a new virtual machine on the first screen, and click Next.

Selecting a VM creation type.

Select a name and guest OS. Enter a VM name, for example MacOS10-12, and select the following VM options:

Compatibility: ESXi 6.0 virtual machine.

Guest OS family: Mac OS.

Guest OS version: Apple Mac OS X 10.10 (64-bit). Select the latest available version in the drop-down menu.

Mac OS as a guest OS family, and Apple Mac OS X as a guest OS version are available after applying the unlocker patch. Click Next to continue.

Selecting a name and guest OS.

Select storage. Select the datastore in which you want to store the VM files. The datastore40 is selected in this example. Click Next.

Selecting storage for a new VM.

Customize settings. Configure the VM hardware and the additional options. Define the following parameters:

CPU: 2 or more.

Memory: 4096 MB or more.

Hard disk: 30 GB or more (you can use a thin provisioned virtual disk to save storage space).

CD/DVD Drive: Select the Datastore ISO file, check the box Connect at power on, click Browse and select the ISO file (Sierra.iso) as DVD media from your datastore.

After configuring the VM settings click Next.

Customizing settings

Ready to complete. Review your VM settings and click Finish to create the VM.

VM settings review.

Now you can try to run the VM. Make sure that the boot order is configured correctly, and that the VM is configured to boot from the DVD drive. If you run the virtual machine on VMware ESXi, you would now see the following issue: the Mac OS X Sierra 10.12 installer hangs when the progress bar approaches 90%.

Progress bar stuck on 90% on boot macOS High Sierra.

Let’s configure the VM to fix this issue. The smc.version = "0" string must be added to the virtual machine VMX configuration file. Right click the VM in VMware Host Client, then click Edit settings in the context menu. Click VM options > Advanced > Edit configuration. In Configuration Parameters click Add parameter. Click to edit the new key and type smc.version in the Key column. Then click the value and enter 0 (see the screenshot below). Another solution is to downgrade the VM hardware version to 10.

Editing VM configuration parameters for macOS installation

You can also use the SSH client to edit the VMX file in the console. Power off the VM. Log in to the ESXi server with an SSH client such as PuTTY.

Go to the directory of your virtual machine:

cd /vmfs/volumes/datastore40/MacOS10-12

Edit the VMX configuration file of the VM with vi:

vi MacOS10-12.vmx

Press o to add a new line.

Enter smc.version = "0"

Press Esc, type :wq and press Enter.

Now power on the virtual machine and start installing Mac OS X 10.12 High Sierra on the VM that is running on the ESXi host.

Installing Mac OS as a Guest OS on a VMware VM

After macOS installer has loaded, you should see the installation wizard.

  1. Select the main language and click the Next button. English is used in this installation example.
  2. To set up the installation of macOS, click Continue.
  3. Read the license agreement carefully. If everything is right and you accept the license agreement, click Continue. Then click the Agree button in the popup window on the top of the screen.
  4. Install macOS. In this step you must prepare a partition on your virtual hard disk. Click Utilities > Disk Utility.

Opening the disk utility.

Enter a name for your disk (vmdisk1 in this case), select a format (Mac OS Esxended (Journaled)), select a scheme (GUID Partition Map) and click Erase. After erasing the media, close the Disk Utility window.

Preparing a disk with the disk utility

Select the disk that you have prepared (vmdisk1) and click Continue.

Continuing macOS installation on vmdisk1.

  1. Wait until the macOS installer installs the operating system.
  2. Restart your machine to complete the installation of macOS on your disk (click the Restart button).
  3. Once your ESXi virtual machine has been restarted, customize your macOS. On the Welcome screen select your country and click Continue.
  4. Select your keyboard. Choose a keyboard layout and click Continue.
  5. Transfer information to This Mac. Select Don’t transfer any information now and click Continue.
  6. Enable Location Services. Do not check the box Enable Location Services on this Mac and click Continue. Click the Don’t use button in the popup window to confirm.
  7. Sign in with your Apple ID. Click Don’t sign in and click Continue. Click Skip in the popup window to confirm.
  8. Terms and conditions. Read terms and conditions carefully. If you agree with terms and conditions, click the Agree button. Click the Agree button once more to continue.
  9. Create a computer account. Enter a full user name, account name, password, and click Continue.
  10. Select your time zone. Click Continue.
  11. Analytics. Uncheck the boxes Share Mac analytics with Apple and Share crash data with app developers. Click Continue.
  12. Congratulations! Now your macOS Sierra is loaded and you can see a desktop of this operating system running on a VMware ESXi VM.

Installing VMware Tools

Install VMware Tools for macOS running on a VMware VM to improve the performance and user experience. When you apply the unlocker patch for VMware Workstation, a darwin.iso image with VMware Tools for macOS is copied to a VMware Workstation directory. If the darwin.iso image is missing on your ESXi after applying the patch, you can manually copy the ISO file to the datastore by using WinSCP, VMware Host client, or VMware vSphere client. You can also download VMware Tools for Mac OS X from VMware’s website.

Mounting the ISO image that contains VMware Tools for macOS to a DVD drive of the VM.

Once you have copied the image containing VMware Tools to the datastore, open the VM settings and edit CD/DVD drive settings. Select the darwin.iso file as CD/DVD media. In this example darwin.iso is copied to datastore40.

Running the VMware Tools installer.

The VMware Tools installation process is straightforward. Follow the wizard recommendations and click Continue to finish the installation.

Configuring Mac OS to Optimize Running on a VM

Let’s optimize macOS settings to make working with the virtual machine more comfortable.

Setting Screen Resolution

1024 x 768 is the default screen resolution for a virtual machine after installing macOS. Other modes are not available in GUI of macOS. VMware Tools can help you to set higher resolution. After installing VMware Tools, reboot the VM. Open the Launchpad, type terminal in the search field and run the Terminal. Execute the following command in the terminal to set the Full HD resolution:

sudo /Library/Application\ Support/VMware\ Tools/vmware-resolutionSet 1920 1080

VMware Tools are used to adjust the screen resolution in this case. Configured resolution is preserved after a VM reboot. Be aware that the maximum displayed resolution in VMware vSphere Web Client and in VMware Host Client is 1176 x 885. Use VMware Workstation to connect to a VM that is running on an ESXi host for working with higher resolution. You can also use VMware vSphere client (a standalone application that is installed on Windows) for this purpose.

Disabling a Screen Saver

Running a screen saver can consume computing resources when a virtual machine is idle. It is recommended that you disable any screen savers on the VM on which macOS is installed. You can do this with GUI. Open System Preferences > Desktop & Screen Saver. Select Screen Saver and set Start after: Never.

Furthermore, it is recommended that you disable sleep mode to prevent any possible issues and disadvantages (for example if a time-consuming process such as copying files is running in background). Open the terminal and disable sleep mode when idle by using the following commands:

Change the directory to /Applications/Utilities/

cd /Applications/Utilities/

Set the idle period to enter a sleep mode to 0:

sudo systemsetup -setcomputersleep 0

Now screen savers are disabled on your macOS.

Update: Installing macOS Mojave on VMware ESXi 6.7

After initially publishing this blog post, Mac OS X 10.14 Mojave was released. The new Apple’s operating system is becoming more and more popular among macOS users each day. As a result, many people are asking about how they can install macOS Mojave on VMware ESXi server. The logics are similar to the logics of installing the macOS Sierra explained above. The main difference is in the process of creating a bootable ISO installation image for macOS Mojave. If you would use the commands explained for creating the macOS Sierra ISO image when creating the macOS Mojave ISO image you would get an error in the middle of the process after entering the command:

asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase

Could not recognize "/Volumes/install_app/BaseSystem.dmg" as an image file

Could not validate source - Invalid argument

Creating a macOS Mojave Bootable ISO Installation Image

This section explains how to correctly create a macOS Mojave bootable ISO image. First, download the macOS Mojave installer from the App Store. In the current example, a machine running macOS Mojave is used for downloading the macOS Mojave installer to avoid using third party downloading tools. Open AppStore, find macOS Mojave, click View and then click Get to download the installer. Notice that you need a full installer whose size is about 6.03 GB. If after downloading the installer, installation starts automatically, cancel it. After successfully downloading you can see the Install macOS Mojave.app file in the Applications directory. Open Finder and click Applications in the left pane of the Finder window to check the installer file.

Use the set of commands explained below in order to create an installation ISO image for further installation of macOS Mojave on VMware ESXi or VMware Workstation. Make sure you have enough free space on your disk.

  1. Mount the InstallESD.dmg installer included in the Install macOS Mojave.app installer to the /Volumes/Mojave mount point:

hdiutil attach /Applications/Install\ macOS\ Mojave.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/Mojave

  1. Create a blank disk image of 7316 Mb located in the current directory:

hdiutil create -o ./MojaveBase.cdr -size 7316m -layout SPUD -fs HFS+J

  1. Mount the MojaveBase.cdr.dmg image to the install_build mount point:

hdiutil attach ./MojaveBase.cdr.dmg -noverify -mountpoint /Volumes/install_build

  1. Restore the disk image to the install_build directory you have created before:

asr restore -source /Applications/Install\ macOS\ Mojave.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt --noverify -erase

  1. Remove the Packages directory with all containing files:

rm -rf /Volumes/OS\ X\ Base\ System/System/Installation/Packages

  1. Create a new empty directory instead of the previously deleted one:

mkdir -p /Volumes/OS\ X\ Base\ System/System/Installation/Packages

  1. Copy the installation packages:

cp -R /Volumes/Mojave/Packages/* /Volumes/OS\ X\ Base\ System/System/Installation/Packages/

  1. Unmount disks from the directories:

hdiutil detach /Volumes/OS\ X\ Base\ System/

hdiutil detach /Volumes/Mojave/

  1. Rename the MojaveBase.cdr.dmg file to the BaseSystem.dmg file

mv ./MojaveBase.cdr.dmg ./BaseSystem.dmg

  1. Create a blank disk image of 8965 Mb located in the current directory:

hdiutil create -o ./Mojave.cdr -size 8965m -layout SPUD -fs HFS+J

  1. Mount the cdr.dmg image to the install_build directory:

hdiutil attach ./Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build

  1. Restore the disk image to the install_build directory:

asr restore -source /Applications/Install\ macOS\ Mojave.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt --noverify -erase

  1. Copy the BaseSystem.dmg image to the "OS X Base System" directory:

cp ./BaseSystem.dmg /Volumes/OS\ X\ Base\ System/

  1. Unmount the "OS X Base System" directory:

hdiutil detach /Volumes/OS\ X\ Base\ System/

  1. Convert the cdr.dmg image to the iso image. You can use a location with enough free space that is convenient for you.

hdiutil convert ./Mojave.cdr.dmg -format UDTO -o ./Mojave.iso

  1. Rename the Mojave.iso.cdr file to the Mojave.iso file and move it to your desktop for more convenience.

mv ./Mojave.iso.cdr ~/Desktop/Mojave.iso

  1. If everything is OK, remove the cdr.dmg file:

rm ./Mojave.cdr.dmg

Deploying a VM to Install macOS Mojave on VMware ESXi

Now you have a bootable ISO installation disk image of Mac OS X 10.14 Mojave and you can install macOS Mojave on your VMware ESXi host. The rest of actions are similar to actions explained above for installing macOS Sierra on a VM of the VMware ESXi format but you should be aware of the following features:

If you install mac OS Mojave on ESXi 6.0 after applying the Unlocker 2.0.8, you may get an error during macOS installation:

An error occurred while preparing the installation. Try running this application again.

In order to avoid this issue, use VMware ESXi 6.7 and macOS Unlocker 3.0.0. Download this free Unlocker patch from the author’s site or from GitHub (you can also view a source code there). Then take the following steps:

  • Patch ESXi 6.7.
  • Restart the ESXi host.
  • Create a new VM, select ESXi 6.7 compatibility. Prefer using SSD disks for deploying VMs running Mac OS X 10.14.
  • Select the OS version Apple macOS 10.14.
  • Mount the Mojave.iso file to a virtual CD/DVD drive of the VM.
  • Start the virtual machine and install macOS Mojave.

Conclusion

MacOS can be installed on a VMware VM running on ESXi. This can be done after the preparation of a bootable installation image of the ISO format with hdiutil, applying a free patch on an ESXi server and configuring certain VM settings. It is not recommended to install the macOS unlocker patch on ESXi servers that are used in production environments, in order to minimize the probability of any possible issues or negative impacts on production VMs. In this blog post, we have covered the installation of macOS Sierra due to its high popularity among users; however, you can also use the explained logics for installing macOS High Sierra and macOS Mojave on VMware VMs running on ESXi.




:: موضوعات مرتبط: سیستم عامل , ,
:: برچسب‌ها: How to Run Mac OS on VMware ESXi ,
می توانید دیدگاه خود را بنویسید


نام
آدرس ایمیل
وب سایت/بلاگ
:) :( ;) :D
;)) :X :? :P
:* =(( :O };-
:B /:) =DD :S
-) :-(( :-| :-))
نظر خصوصی

 کد را وارد نمایید:

آپلود عکس دلخواه:








آخرین ارسال های انجمن
عنوان پاسخ بازدید توسط

???????????? مقدمتان محترم خیلی خوش آمدید
<-ForumPostTitle-> <-ForumPostUrl-> <-ForumPostCountAnswer-> <-ForumPostHit-> <-ForumPostLastAuthor->

RSS

Powered By
loxblog.Com